<?php
class admin extends Controller
{
	
	function __constructor()
	{
		parent::__constructor();
	}
	
	
	function index()
	{
		is_logged_in("",array(1));
		$this->load->view("admin/home");
	}
	
	
	function lookup()
	{
		is_logged_in("",array(1));
		$this->load->model("model_lu");
		
		$r = $this->model_lu->get();
		$data['crum'] = build_crum( array("Admin", "Lookup" ) );
		$data['lus'] = $r;
		$this->load->view("admin/lookup",$data);
	}
	
	function lookupedit()
	{
		is_logged_in("",array(1));
		
		$id = $this->uri->segment(3);
		$this->load->model("model_lu");
		
		$r = $this->model_lu->get_from_id($id);
		$data['crum'] = build_crum( array("Admin", "Lookup", "#$id" ) );
		$data['lu'] = $r;
		$this->load->view("admin/lookupedit",$data);
		
	}
	
	function lookupupdate()
	{
		is_logged_in("",array(1));
		
		$this->load->model("model_lu");
		$id = $this->input->post("id");
		
		$update = array( "lu_lable" => $this->input->post("lu_lable")
						 ,"lu_type" => $this->input->post("lu_type")
						 ,"lu_value" => $this->input->post("lu_value")
					   );
		
		$this->model_lu->update($update, $id);		
		
		redirect(base_url() ."/admin/lookup");
		
	}
}